home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
misc_pto
/
advtutr
/
advent1.doc
< prev
next >
Wrap
Text File
|
1986-02-14
|
7KB
|
125 lines
How to write an Adventure
It seems to me that there have got to be others out there in modem ì
country who have adventure running around in their heads. If you are like me, ì
you are brimming over with plots, and just can't fathom how to code them. ì
Well, since I started writing adventures in 1981, I've learned alot about how ì
to code. In the this series of files (and it may take a few days for them to
all appear) we'll demonstrate how to make the computer understand our input ì
and act out the adventure. The coding is coing to be "plain vanilla"... ì
nothing fancy with the screen or machine specific. Just code that will create ì
an adventure, and which will be easily transportable from machine to machine.
Some conventions in Adventuring
An adventure is a hybrid sort of program. It is a semi-intelligent ì
word-recognition program which takes simple english commands and acts upon ì
them, updating some sort of situation display in the process. The point of an ì
adventure is almost always a puzzle. The puzzle may be escape from an ì
unpleasant fate or surrounding, or the gathering of treasure or other prizes.
What all adventures have in common are some basic concepts, and some ì
basic parts.
The first part of the adventure is the situation display. This may take ì
the form of a simple display that says:
YOU SEE: A GRASSY MEADOW
VISABLE OBJECTS: A TALL OAK TREE
YOU CAN GO: N,S,E,W,U
This is the format made popular by Scott Adams, and most adventurers ì
have, at one time or another seen this style display. It is easy to code, and ì
easy for the player to understand. A little harder to code is the interactive ì
fiction/text adventure. The same display above would read like this:
YOU ARE IN A GRASSY MEADOW. THERE IS A TALL OAK TREE NEARBY. YOU CAN GO ì
NORTH, EAST, SOUTH, OR WEST, AND THE TREE LOOKS CLIMBABLE.
This is tougher to code, and unless there is interest in examples of it, ì
we probably are not going to go into it here.
The second part of the adventure is the command parser. It begins with a ì
prompt asking for user input (ex: WHAT WOULD YOU LIKE TO DO?). After ì
accepting the user input, the parser does a number of things.
1. It checks to see if there are two words present.
2. If only one word is present, it diverts the flow of the program to the ì
single word recognition list.
3. If two words are present, it divides the input string into two parts, ì
and passes the parts to the command interpreter.
The Command interpreter is the third and most complex part of the ì
adventure. It is usually organized along these lines:
First, the verb is evaluated. If a good verb (understood by the program) ì
control is passed to a set of lines in the code designed to deal with that ì
verb.
Second, the noun is evaluated. If the noun is one recognized as having ì
meaning in the context of the verb, action takes place. If not, then a message ì
is printed indicating that the input is meaningless.
Pre-planning